//这是文章路由模块

//首先导入express
const express = require('express');

//创建路由对象
const router = express.Router();


//导入验证数据的中间件
const expressJoi = require('@escook/express-joi');
//导入文章分类的验证模块
const {add_cate_schema ,delete_cate_schema, get_cate_schema,update_cate_schema } = require('../schema/artcate');


//导入文章分类路由处理函数模块
const artcate_handler = require('../router_handler/artcate');

//获取文章分类的列表数据
router.get('/cates', artcate_handler.getArticleCates);

//新增文章分类的路由    调用验证的中间件  要验证的对象放进里面
router.post('/addcates',expressJoi(add_cate_schema), artcate_handler.addArticleCates);

//根据 id 删除文章分类的路由
router.get('/deletecate/:id',expressJoi(delete_cate_schema), artcate_handler.deleteCateById)

//根据 Id 获取文章分类数据
router.get('/cates/:id',expressJoi(get_cate_schema), artcate_handler.getArtCateById);


//根据 Id 更新文章分类数据
router.post('/updatecate',expressJoi(update_cate_schema ), artcate_handler.updateCateById)






//把路由暴露出去
module.exports = router;